<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>LavaJet</title>
</h:head>
<h:body>
	<h:form>
		<p:panel id="panel" header="Vinculo">
			<p:messages id="messages" />
			<h:panelGrid columns="3" cellpadding="5">

				<h:outputLabel value="CPF:" style="font-weight:bold" />
				<p:inputMask id="cpf" value="#{cadastroBean.cliente.cpf}"
					label="Cpf" mask="999.999.999.99" required="true" />
				<p:message for="cpf" id="msgCpf" display="icon" />

				<h:outputLabel value="Placa:" style="font-weight:bold" />
				<p:inputMask id="placa" value="#{cadastroBean.veiculo.placa}"
					mask="aaa-9999" required="true" label="Placa" />
				<p:message for="placa" id="msgPlaca" display="icon" />

				<p:commandButton id="avancarConfirmar" value="Vincular"
					actionListener="#{cadastroBean.criaMensagemVinculo}"
					oncomplete="confirmation.show()" type="submit"
					update="confirmDialog">
				</p:commandButton>


			</h:panelGrid>

			<p:confirmDialog id="confirmDialog" message="Confirmar vinculo?"
				header="Vincular cliente X veiculo" severity="alert"
				widgetVar="confirmation">

				<h:panelGrid columns="4" cellpadding="5" frame="below">
					<h:outputLabel value="Nome:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.nome}" />

					<h:outputLabel value="RG:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.rg}" />

					<h:outputLabel value="CPF:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.cpf}" />

					<h:outputLabel value="CEP:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.cep}" />

					<h:outputLabel value="Cidade:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.cidade}" />

					<h:outputLabel value="Endereco:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.endereco}" />

					<h:outputLabel value="Telefone:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.telefone}" />

					<h:outputLabel value="Celular:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.celular}" />

					<h:outputLabel value="E-Mail:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.cliente.email}" />
				</h:panelGrid>

				<h:panelGrid columns="4" cellpadding="5">
					<h:outputLabel value="Marca:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.veiculo.marca}" />

					<h:outputLabel value="Modelo:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.veiculo.modelo}" />

					<h:outputLabel value="Placa:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.veiculo.placa}" />

					<h:outputLabel value="Cor:" style="font-weight:bold" />
					<h:outputLabel value="#{cadastroBean.veiculo.cor}" />
				</h:panelGrid>
				<br />
				<h:panelGroup>
					<p:commandButton id="sim" value="Sim"
						oncomplete="confirmation.hide()"
						actionListener="#{cadastroBean.vincular}" />

					<p:commandButton id="cancelar" value="Cancelar"
						onclick="confirmation.hide()" type="button" />
				</h:panelGroup>
			</p:confirmDialog>
		</p:panel>
	</h:form>
</h:body>
</html>